<?php
namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Redis;

class Theme extends Model
{
	protected $table = 'theme';
	protected $primaryKey = 'id';
	public $timestamps = false;
	
	
	/**
	 * 获取管理员信息
	 * $p['theme_id']
	 * $p['size']
	 * @author wudi
	 */
	public static function get_theme($p=[]){
		$list = DB::table('theme')->select('id','theme_id','title','img','summary','views','add_date');
		if(isset($p['theme_id'])){
			$list->where('theme_id',$p['theme_id']);
		}
		$size = $p['size']??10;
		$list->orderBy('views','desc')->limit($size);
		$rs = $list->get()->toArray();
		return $rs;
	}
}